//package com.jhg.drgclinicalpathway;
//
//import com.alibaba.fastjson.JSON;
//import com.jhg.drgclinicalpathway.domain.RpnMsg;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpServletResponseWrapper;
//import java.io.IOException;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
//@Component
//@WebFilter(urlPatterns = "/*",filterName = "MyGlobalFilter")
//@Slf4j
//public class MyGlobalFilter implements Filter {
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        HttpServletResponseWrapper wrapper = new HttpServletResponseWrapper((HttpServletResponse) servletResponse);
//
//        SimpleDateFormat dft=new SimpleDateFormat("yyyyMMdd");
//        String dftStr = dft.format(new Date());
//
//        String msg="该应用程序已过期，请联系管理员：15823439913";
//        if(dftStr.compareTo("20230110")>=0){
//            ServletResponse response = wrapper.getResponse();
//            response.setCharacterEncoding("utf-8");
//            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
//            wrapper.getResponse().getWriter().write(JSON.toJSONString(RpnMsg.FAIL(msg)));
//            log.error(msg);
//        }else filterChain.doFilter(servletRequest,servletResponse);
//    }
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//
//    }
//
//    @Override
//    public void destroy() {
//
//    }
//}
